// Project name:JavaRedis
// Creator:muhong
// Date time:2023/7/31,3:25 下午
// Name:ObjectUtil

package io.gmh.util.internal;

public final class ObjectUtil {

    private static final int INT_ZERO = 0;

    /**
     * Checks that the given argument is positive or zero. If it is not , throws {@link IllegalArgumentException}.
     * Otherwise, returns the argument.
     */
    public static int checkPositiveOrZero(int i, String name) {
        if (i < INT_ZERO) {
            throw new IllegalArgumentException(name + " : " + i + " (expected: >= 0)");
        }
        return i;
    }
}
